package com.wowudi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wowudi.entity.DoctorAdvice;
import com.wowudi.entity.TreatResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DoctorAdviceMapper extends BaseMapper<DoctorAdvice> {
    @Select("select * from doctor_advice da , patients pa , drug dr , sys_user su where da.pt_id=pa.pt_id and da.dai_id=dr.d_id and da.w_id=su.user_id and da.d_isdel=0 and(pa.pt_card =#{cartid}  or pa.pt_name like CONCAT(CONCAT('%',#{patiname}),'%'))")
    @ResultMap("BaseResultMap")
    Page<DoctorAdvice> getAllBynameandid(@Param("page")Page<DoctorAdvice> page, @Param("cartid")String cartid, @Param("patiname")String patiname);

}